<template>
	<view class="container">
		<uni-forms label-width="100" err-show-type="toast" :rules="rules" :modelValue="formData" ref="form"
			label-position="top">
			<uni-forms-item label="招聘人数" name="name">
				<uni-easyinput trim class="uni-easyinput" disabled :inputBorder="false" type="number"
					v-model="formData.name" disableColor="#fff" @tap="showCityPicker" placeholder="请输入招聘人数(人)"
					suffixIcon="right" />
				<!-- <text class="yzb yzb-next icon-next"></text> -->
			</uni-forms-item>
			<uni-forms-item label="地区设置" name="name">
				<uni-easyinput trim class="uni-easyinput" :inputBorder="false" type="number" v-model="formData.name"
					placeholder="请选择地区" />
			</uni-forms-item>
			<uni-forms-item label="保证金缴纳" name="name">
				<uni-easyinput trim class="uni-easyinput" :inputBorder="false" type="number" v-model="formData.name"
					placeholder="请输入保证金金额(元)" />
			</uni-forms-item>
			<uni-forms-item label="结算方式" name="name">
				<uni-easyinput trim class="uni-easyinput" :inputBorder="false" type="number" v-model="formData.name"
					placeholder="请输入结算方式" />
			</uni-forms-item>
			<uni-forms-item label="有效时间" name="name">
				<uni-easyinput trim class="uni-easyinput" :inputBorder="false" type="number" v-model="formData.name"
					placeholder="请输入有效时间(天)" />
			</uni-forms-item>
		</uni-forms>
		<button class="submit" @click="submitForm">确认发布</button>
		<mpvue-city-picker ref="mpvueCityPicker" :pickerValueDefault="pickerValueDefault" @onConfirm="onConfirm">
		</mpvue-city-picker>
	</view>
</template>

<script>
	import mpvueCityPicker from "@/components/mpvue-citypicker/mpvueCityPicker.vue"
	export default {
		components: {
			mpvueCityPicker
		},
		data() {
			return {
				formData: {
					name: '',
				},
				pickerValueDefault: [0, 0, 1],
				rules: {
					name: {
						rules: [{
							required: true,
							errorMessage: '招聘人数',
						}]
					},
				}
			};
		},
		onLoad() {

		},
		methods: {
			showCityPicker() {
				this.$refs.mpvueCityPicker.show();
			},
			onConfirm(e) {
				console.log(e);
				this.formData.name = e.label;
			},
			submitForm() {
				this.$refs.form.validate().then(res => {
					console.log('表单数据信息：', res);
				}).catch(err => {
					console.log('表单错误信息：', err);
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.container {
		padding: 30rpx 36rpx;

		/deep/ .uni-forms-item__label .label-text {
			font-weight: bold;
			font-size: 32rpx;
			color: #292F44;
		}

		/deep/ .uni-easyinput {
			background: #FFFFFF;
			border-radius: 10rpx;
			font-weight: bold;
			font-size: 32rpx;
			color: #292F44;
		}

		.uni-easyinput {
			height: 94rpx;
		}

		/deep/ .uni-easyinput__content-textarea {
			height: 381rpx;
			padding: 30rpx;
		}

		/deep/ .uni-easyinput__content-input {
			padding-left: 0 !important;
		}

		/deep/ .is-disabled {
			background: #FFFFFF !important;
			color: #292F44 !important;
		}

		/deep/ .uni-forms-item__inner {
			padding-top: 20rpx;
			padding-bottom: 20rpx;
			border-bottom: 1rpx solid #E6E6E6;
		}
	}

	.submit {
		height: 98rpx;
		line-height: 98rpx;
		background: #3A92FF;
		border-radius: 10rpx;
		position: fixed;
		left: 20rpx;
		right: 20rpx;
		bottom: 32rpx;
		font-weight: 500;
		font-size: 36rpx;
		color: #FFFFFF;
		display: flex;
		align-item: center;
		justify-content: center;
	}
</style>